/*
 * This file is part of "Deathwatch Ammo Counter for Android".
 *
 * "Deathwatch Ammo Counter for Android" is free software: you can redistribute
 * it and/or modify it under the terms of the GNU General Public License as 
 * published by the Free Software Foundation, either version 3 of the License, 
 * or (at your option) any later version.
 *
 * "Deathwatch Ammo Counter for Android" is distributed in the hope that it 
 * will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General 
 * Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with "Deathwatch Ammo Counter for Android".  
 * If not, see <http://www.gnu.org/licenses/>.
 * 
 */
package com.TikiiTorch.Deathwatch.AmmoCounter;

public class AmmoClip {

	private int clipSize;

	private int roundCount;

	public AmmoClip(int clipSize) {
		this.clipSize = clipSize;
		this.roundCount = 0;
	}

	public int getClipSize() {
		return this.clipSize;
	}

	public int getRoundCount() {
		return this.roundCount;
	}
	
	public void setRoundCount(int roundCount){
		this.roundCount = roundCount;
	}

	public int reload() {
		int roundsUsed = clipSize - roundCount;
		this.roundCount = clipSize;
		return roundsUsed;
	}

	public int reload(int bagAmount) {
		if ((this.roundCount + bagAmount) > clipSize) {
			return reload();
		} else {
			this.roundCount += bagAmount;
			return bagAmount;
		}
	}

	public void expendRounds(int count) {
		this.roundCount -= count;
	}

}
